package cn.roadtrip.mtravelbusinessmodule.mvc.basic;

import cn.roadtrip.mtravelbusinessmodule.bs.basic.BasicBusinessImpl;
import cn.roadtrip.mtravelbusinessmodule.sql.couple.tables.records.CoupleShopPdtRecord;
import cn.roadtrip.mtravelbusinessmodule.sql.couple.tables.records.CoupleShopRecord;
import cn.roadtrip.utilmodule.util.DataBean;
import org.jooq.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/basic")
public class BasicController {

    @Autowired
    private BasicBusinessImpl basicBusinessImpl;

    @PostMapping("/queryPortalProductList")
    public DataBean queryPortalProductList(
            @RequestBody BasicBusinessImpl.Model_queryPortalProductList model
    ) {
        return basicBusinessImpl.queryPortalProductList(model);
    }

    @PostMapping("/getShopProductView")
    public DataBean getShopProductView(
            @RequestBody BasicBusinessImpl.Model_getShopProductView model
    ) {
        return basicBusinessImpl.getShopProductView(model);
//        DataBean<CoupleShopPdtRecord> db = basicBusinessImpl.getShopProductView(model);
//        try {
//            return db.reSetValue(db.getResult().intoMap());
//        } catch (Exception e) {
//            e.printStackTrace();
//            return db;
//        }
    }

    /**
     * 查询出城市对应的景区
     *
     * @param model
     * @return
     */
    @PostMapping("/queryScenicByCity")
    public DataBean queryScenicByCity(@RequestBody BasicBusinessImpl.Model_queryScenicByCity model) {

        return basicBusinessImpl.queryScenicByCity(model);
//        DataBean<Result<CoupleShopRecord>> db = basicBusinessImpl.queryScenicByCity(model);
//        try {
//            return db.reSetValue(db.getResult().intoMaps());
//        } catch (Exception e) {
//            e.printStackTrace();
//            return db;
//        }

    }


}
